﻿using System;
using System.Collections.Generic;
using System.Text;
using GroupChat2013.Entity;

namespace GroupChat2013.Logic.Message
{
    /// <summary>
    /// 群聊天信息中的图片上传下载类
    /// </summary>
    public class GroupImageUpload : AbstractImageUpload
    {
        private string groupId;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="userInfo">当前用户信息</param>
        /// <param name="groupId">群ID</param>
        public GroupImageUpload(UserInfo userInfo, string groupId)
            : base(userInfo)
        {
            this.groupId = groupId;
        }

        /// <summary>
        /// 上传图片
        /// </summary>
        /// <param name="localUrl">图片本地路径</param>
        /// <returns></returns>
        public override string UpLoadImage(string localUrl)
        {
            return urlProxy.UploadGroupChatImageURL(groupId, localUrl, m_UserInfo.CID);
        }

        /// <summary>
        /// 下载图片
        /// </summary>
        /// <param name="imageMD5Name">图片名称</param>
        /// <param name="savePath">保存路径</param>
        public override void DownlodImage(string imageMD5Name, string savePath)
        {
            urlProxy.DownGroupChatImage(m_UserInfo.CID, groupId, imageMD5Name, savePath);
        }
    }
}
